#include <iostream>

class A
{
public:
    A(int a,int b)
    {
        this->a = a;
        this->b = b;
    }
    virtual void print()
    {
        std::cout << this->a << " " << this->b << std::endl;
    }
protected:
    int a;
    int b;
};

class B : public A
{
public:
    B(int a,int b,int c):A(a,b)
    {
        this->c = c;
    }
    void print()
    {
        std::cout << this->a << " " << this->b << " " << this->c << std::endl;
    }
private:
    int c;

};

void print(A* p)
{
    p->print();
}

int main()
{
    A a(1,2);
    B b(4,5,6);
    print(&a);
    print(&b);
    return 0;
}